﻿@model CodeCamp.Models.Email.BasicEmailEdit


@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend></legend>

        @Html.HiddenFor(model => model.SubmitButtonText)
        @Html.HiddenFor(model => model.EmailItemId)
        @Html.HiddenFor(model => model.EmailCampaignId)
        @Html.HiddenFor(model => model.EnableEmailViewEdit)
        @Html.HiddenFor(model => model.EnableSendStatusEdit)
        @Html.HiddenFor(model => model.EnableSendStatusView)
        @Html.HiddenFor(model => model.EnableTestMessageEdit)
        @Html.HiddenFor(model => model.ParentContext)
        @Html.HiddenFor(model => model.SiteUserId)

        @if (!Model.EnableEmailViewEdit)
        {
            @Html.HiddenFor(model => model.EmailView)
        }




        <table class="no-border" style="margin-left:0;">
            <tr>
                <td class="no-border twocol-20" style="margin-left:0;">
                @if (Model.EnableSendStatusView)
                {
                <div class="editor-label">
                    @Html.LabelFor(model => model.SendStatus, "Send Status")
                </div>
                <div class="editor-field">
                    @Html.DisplayTextFor(model => model.SendStatus)
                </div>
                }
                @if (Model.EnableSendStatusEdit)
                {
                <div class="editor-label">
                    @Html.LabelFor(model => model.SendStatusID, "Status")
                </div>
                <div class="editor-field">
                    @Html.DropDownListFor(model => model.SendStatusID, Model.SendStatusSelectList)
                    @Html.ValidationMessageFor(model => model.SendStatusID)
                </div>
                }
                else
                {
                    @Html.HiddenFor(model => model.SendStatusID)
                }
                </td>
                <td class="no-border twocol-20" style="margin-left:0;">
                @if (Model.EnableTestMessageEdit)
                {
                <div class="editor-label">
                    @Html.LabelFor(model => model.TestMessage, "Test Message")
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.TestMessage)
                    @Html.ValidationMessageFor(model => model.TestMessage)
                </div>
                }
                else
                {
                    <div class="editor-label">
                        @Html.LabelFor(model => model.TestMessage, "Test Message:")
                    </div>
                    <div class="editor-field">
                        @Html.DisplayTextFor(model => model.TestMessage)
                    </div>
                    @Html.HiddenFor(model => model.TestMessage)
                }
                </td>
            </tr>
            <tr>
                <td class="no-border twocol-20" style="margin-left:0;">
                @if (Model.EmailCampaignId.HasValue && Model.CampaignStatus.HasValue)
                {
                <div class="editor-label">
                    @Html.LabelFor(model => model.CampaignStatus, "Campaign Status:")
                </div>
                <div class="editor-field">
                    @Html.DisplayTextFor(model => model.CampaignStatus)
                </div>
                }
                </td>
                <td class="no-border twocol-20">
                    @if (Model.EmailCampaignId.HasValue && Model.CampaignRecipientType.HasValue)
                    {
                    <div class="editor-label">
                        @Html.LabelFor(model => model.CampaignRecipientType, "Recipient Type:")
                    </div>
                    <div class="editor-field">
                        @Html.DisplayTextFor(model => model.CampaignRecipientType)
                    </div>
                    }
                </td>
            </tr>
            <tr>
                <td colspan="2" class="no-border">
        @if (Model.EmailCampaignId.HasValue && !string.IsNullOrWhiteSpace(Model.CampaignDescription))
        {
        <div class="editor-label">
            @Html.LabelFor(model => model.CampaignDescription, "Campaign Description:")
        </div>
        <div class="editor-field">
            @Html.DisplayTextFor(model => model.CampaignDescription)
        </div>
        }
                </td>
            </tr>
            <tr>
                <td class="no-border twocol-20" style="margin-left:0;">
        <div class="editor-label">
            @Html.LabelFor(model => model.FirstName, "First Name")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstName)
            @Html.ValidationMessageFor(model => model.FirstName)
        </div>
                </td>
                <td class="no-border twocol-20">
        <div class="editor-label">
            @Html.LabelFor(model => model.LastName, "Last Name")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastName)
            @Html.ValidationMessageFor(model => model.LastName)
        </div>
                </td>
            </tr>
        </table>


        @if (Model.EnableEmailViewEdit)
        {
        <div class="editor-label">
            @Html.LabelFor(model => model.EmailView, "Email View")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EmailView)
            @Html.ValidationMessageFor(model => model.EmailView)
        </div>
        }

        <div class="editor-label">
            @Html.LabelFor(model => model.ReplyToAddress, "Reply To Address")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ReplyToAddress)
            @Html.ValidationMessageFor(model => model.ReplyToAddress)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Subject)
        </div>
        <div class="editor-field">
            @if (Model.TestMessage) { <text>Test: </text> }
            @Html.EditorFor(model => model.Subject)
            @Html.ValidationMessageFor(model => model.Subject)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EmailTo, "Email To")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EmailTo)
            @Html.ValidationMessageFor(model => model.EmailTo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CustomContent1)
            @Html.ValidationMessageFor(model => model.CustomContent1)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.CustomContent1, new { cols = 80, rows = 10 })
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CustomContent2)
            @Html.ValidationMessageFor(model => model.CustomContent2)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.CustomContent2, new { cols = 80, rows = 10 })
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Salutation)
            @Html.ValidationMessageFor(model => model.Salutation)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Salutation, new { cols = 60, rows = 5 })
        </div>

        <p>
            <input type="submit" value="@Model.SubmitButtonText" />
        </p>
    </fieldset>
}
